import { ApiProperty } from '@nestjs/swagger';
import { IsOptional, IsString, MaxLength, MinLength } from 'class-validator';

export class UpdateUserDTO {
  @ApiProperty({ example: 'newpassword123', description: '用户密码', required: false })
  @IsOptional()
  @IsString({ message: '密码必须是字符串' })
  @MinLength(6, { message: '密码长度不能少于6' })
  @MaxLength(20, { message: '密码长度不能超过20' })
  password?: string;

  @ApiProperty({ example: '新用户名', description: '用户名称', required: false })
  @IsOptional()
  @IsString({ message: '用户名称必须是字符串' })
  @MaxLength(20, { message: '用户名称长度不能超过20' })
  name?: string;

  @ApiProperty({ example: 'admin', description: '用户角色', required: false })
  @IsOptional()
  @IsString({ message: '用户角色必须是字符串' })
  role?: string;
}